package _21define;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class NewOutPut {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入文本路径");
        String a=sc.nextLine();
        FileOutputStream out=null;
        boolean flag=true;
        while (flag){
            System.out.println("请输入字符串");
            String b=sc.nextLine();
            if (b.equals("end")){
                flag=false;
                System.out.println("输入结束");
            }else {
                try {
                    out = new FileOutputStream(a,true);
                    out.write(b.getBytes());
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
